#include "stdafx.h"

#include "hwinobject.h"
#include "hwincomobject.h"
#include "hwinexception.h"
#include "hwinenvironment.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>

namespace harlinn
{
    namespace windows
    {
        // ----------------------------------------------------------------------
        // Object
        // ----------------------------------------------------------------------

        HWIN_EXPORT Object::Object()
            : comObject(nullptr)
        {
            HWIN_TRACE();
            
        }

        HWIN_EXPORT Object::~Object()
        {
            if(comObject)
            {
                comObject->object = nullptr;
                comObject = nullptr;
            }
        }

        HWIN_EXPORT Object& Object::Initialize()
        {
            return *this;
        }


        


        HWIN_EXPORT HRESULT STDMETHODCALLTYPE Object::QueryInterface( REFIID riid, void **ppvObject )
        {
            if (!ppvObject)
            {
                return E_INVALIDARG;
            }
            *ppvObject = NULL;

            if(!comObject)
            {
                comObject = this->CreateComObject();
            }

            auto hr = comObject->InternalQueryInterface(riid, ppvObject);
            comObject->InternalRelease();
            return hr;
        }

        

        HWIN_EXPORT Object& Object::Assign(const Object& source)
        {
            return *this;
        }
        HWIN_EXPORT String Object::GetNamePath() const
        {
            return String();
        }
        
        HWIN_EXPORT std::shared_ptr<Object> Object::GetOwner() const
        {
            return std::shared_ptr<Object>();
        }
        HWIN_EXPORT const Object& Object::AssignTo(Object& destination) const
        {
            return *this;
        }

        HWIN_EXPORT ComObject* Object::CreateComObject() const
        {
            return nullptr;
        }






        






    };
};